Foreward

This tool is designed to provide a mathematical aid in optimizing a portfolio of your selection. It is designed to give some salient information on your selected stocks, and then by simulation, identify the minimum variance and optimum portfolios. At default the code runs 100,000 portfolio simulations, but feel free to adjust the ‘num_port’ variable in the ‘PORTFOLIO BUILDING’ chunk to your own desires.

Before we continue a few things to note:

Interactive Graph of Stock Performance

This section provides a view of the stocks relative performances against one another. Hovering will show the values at that point in the top right. I would reccomend not going above 12 stocks in this tool, it can handle it but colours will be reused and the picture will lose clarity.

Correlation Plot

This section prints a correlation plot of your proposed portfolio. It can be useful to understand the relationships between the stocks you have chosen. High correlation may suggest over exposure to a particular industry.

Minimum Variance Portfolio

A minimum variance portfolio is an investment strategy that aims to minimize the risk of a portfolio by diversifying the holdings in such a way that the price volatility of the entire portfolio is brought down 1. The idea behind this strategy is to combine high-risk stocks in a manner that offsets each other, ultimately reducing the volatility of the entire portfolio 1. This approach is influenced by the modern portfolio theory given by Harry Markowitz. In 1952, Markowitz stated that portfolio variance could be minimized if stocks are selected using negative correlation. If the correlation between assets within a portfolio is less, variance is also less 1. The minimum variance method considers the investment weight and the variance of each investment 1.

To put it simply, a minimum variance portfolio is a collection of securities that combine to minimize the price volatility of the overall portfolio 2. By diversifying your holdings, you can reduce volatility and balance out investments that may be risky on their own 2.

This section reveals the mweightings of your selected stocks that gives the lowest variance. Keep in mind all the conditions of the strategy above may not have been met by your selection.

Optimal Portfolio

The Sharpe ratio is a measure of how much return an investment generates for the amount of risk it takes on 1. It is named after William Sharpe, who developed the ratio in 1966 1. The Sharpe ratio is calculated by subtracting the risk-free rate of return from the investment’s rate of return and then dividing that result by the investment’s standard deviation 1. The risk-free rate of return is the return on an investment that carries no risk, such as a government bond 1. The standard deviation measures how much the investment’s returns vary over time 1.

In simpler terms, the Sharpe ratio helps investors understand how much return they are getting for each unit of risk they take on 1. A higher Sharpe ratio indicates that an investment is generating more return per unit of risk than a lower Sharpe ratio investment 1. For example, if two investments have the same rate of return but one has a higher standard deviation, then it has a lower Sharpe ratio because it is taking on more risk to generate that return 1.

This is the portfolio weighting with the highest Sharpe Ratio found in our simulations